// 视口meta初始化
function initViewport() {
    let meta = document.querySelector('meta[name="viewport"]');
    if (!meta) {
        meta = document.createElement('meta');
        meta.name = 'viewport';
        document.head.appendChild(meta);
    }
    meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=0.5';
}

// 动态字体调整
function adjustFontSize() {
    const width = window.innerWidth;
    const baseSize = width < 768 ? 14 : 16;
    document.documentElement.style.fontSize = `${baseSize}px`;
}

// 初始化执行
initViewport();
adjustFontSize();

// 监听窗口变化
window.addEventListener('resize', () => {
    adjustFontSize();
    document.body.style.width = window.innerWidth + 'px';
});
